{{#extends @html/widget/hp/widget.html}}

{{:widget_class}}wg-statistics{{/:widget_class}}

{{:widget_body}}
	{{!connect "theme/widget/statistics.css"}}
	<div class="list-">
		<div class="item-"><span class="group-">Пользователей</span> <span class="count-">{{widget.content.user_count}}</span></div>
		<div class="item-"><span class="group-">Записей</span> <span class="count-">{{widget.content.item_count}}</span></div>
		<div class="item-"><span class="group-">Комментариев</span> <span class="count-">{{widget.content.comments_count}}</span></div>
	</div>
{{/:widget_body}}

{{:settings}}
<div class="popup-body" id="settings_container">
	<form action="" id="settingsform">
	<input type="hidden" name="widget_id" value="{{settings.id}}" id="widget_id" />
	<h2 class="title-">Статистика узла</h2>
	<div class="content-" style="height: 400px; overflow: auto;">
		<fieldset class="fieldset- header- text-">
			<label>Заголовок</label>
			<input type="text" name="title" value="{{settings.title}}" />
			<div class="comment-">Не более 100 символов</div>
		</fieldset>
		<fieldset class="fieldset- header- text-">
			<label>Брать статистику:</label>
			<input type="radio" style="display:inline;width: 24px;" id="from_community" name="from" value="community"{{?'community'==settings.from || !settings.from}} checked="checked"{{/?}} />
			<label for="from_community" style="display:inline; margin-left: 24px;">всего сообщества</label><br />
			<input type="radio" style="display:inline;width: 24px;" id="from_tdis" name="from" value="tdis"{{?'tdis'==settings.from}} checked="checked"{{/?}} />
			<label for="from_tdis" style="display:inline; margin-left: 24px;">только из разделов</label><br />
			<input type="checkbox" style="display:inline;width: 24px;" class="tdicheck-" id="tdi0"{{?settings.root_checked}} checked="checked"{{/?}} name="tdi_list[]" value="0">
			<label for="tdi0" style="display:inline; margin-left: 24px;">Из корня сообщества</label><br />
			{{!for settings.tdis do=@:tdis}}
		</fieldset>
	</div>
	{{@:settingsbutton}}
	</form>
	<script language="JavaScript">
	jQuery("#from_community").bind("click", function(){
		setCheckBoxRights()
	});
	jQuery("#from_tdis").bind("click", function(){
		setCheckBoxRights()
	});
	jQuery().ready( function(){
		setCheckBoxRights();
	});

	function setCheckBoxRights() {
		var from_community = jQuery("#from_community").get(0).checked;
		jQuery("#settings_container").find("input.tdicheck-").each(function(){
			if ( from_community ) {
				this.disabled = true;
				this.checked = false;
			} else {
				this.disabled = false;
			}
		});
	}
	</script>
</div>
{{/:settings}}

{{:tdis}}
<input type="checkbox" style="display:inline;width: 24px;" class="tdicheck-" id="tdi{{*oid}}"{{?*checked}} checked="checked"{{/?}} name="tdi_list[]" value="{{*oid}}">
<label for="tdi{{*oid}}" style="display:inline; margin-left: 24px;">{{*title}}</label><br />
{{/:tdis}}
